<% content_for :css do %>
  <%= stylesheet_link_tag 'new_session'  %>
<% end %>
<div id="new_session">
  <div class="head">
    <div class="title">登录</div>
  </div>
  <div class="body">
    <div id="form">
      <% form_for :session,
              :url => sessions_url,
              :method => :post,
              :html => {
                :id => :new_session_form
              } do |f| %>
      <dl>
        <dt>用户名：</dt>
        <dd>
          <%= f.text_field :name, :size => 25 %>
          <% if flash[:error] %>
            <span class="validation_error"><%= flash[:error] %></span>
          <% end %>
        </dd>
      </dl>
      <dl>
        <dt>密码：</dt>
        <dd><%= f.password_field :password, :size => 25 %></dd>
      </dl>
      <dl>
        <dt>动态密码：</dt>
        <dd>
            <%= f.text_field :dynamic_password, :size => 25 %>
            <span title='请拿出您的密码卡查找出对应的动态密码' class='dynamic_password_feed'>
              <%= @feed %>
            </span>
            <% if Rails.env.development?%>
            <script type="text/javascript">
              $('session_dynamic_password').value = '<%= session[:dynamic_password] %>';
            </script>
            <% end %>
        </dd>
      </dl>
    </div>
    <% end %>
    <div id="buttons">
      <%= link_to_function '登录', "$('new_session_form').submit();", :class => 'save button' %>
      <%= link_to "重置", new_session_url, :class => 'go_back button' %>
    </div>
  </div>
</div>
<% if Rails.env.production? %>
<script>
  send_dynamic_password_sms();
</script>
<% end %>